#include<bits/stdc++.h>
using namespace std;
const int N=5e5+5;
const double eps=1e-9;
inline void read(int &x){
	int f=1;x=0;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar(); 
	x*=f;
}
int n,op[N],idx,a[N],id[N],k[N],T[N];
struct node{double x;int i;}b[N];
inline bool cmp(node x,node y){return x.x<y.x;}
double val[N],v[N];
struct Tree{
	double sum;
	long long st;
}t[N<<2];
#define mid ((l+r)>>1)
void change(int p,int l,int r,int x,double val,int v){
	t[p].sum+=val,t[p].st+=v;
	if(l==r) return;
	if(x<=mid) change(2*p,l,mid,x,val,v);
	else change(2*p+1,mid+1,r,x,val,v);
}
double ls,rs;
long long S,tt,pt,lt,rt,tag;
void query(int p,int l,int r){
	if(l==r){pt=l;tt=t[p].st;return;}
	if(t[2*p].st>=S) rt+=t[2*p+1].st,rs+=t[2*p+1].sum,query(2*p,l,mid);
	else ls+=t[2*p].sum,lt+=t[2*p].st,S-=t[2*p].st,query(2*p+1,mid+1,r);
}
int main(){
	freopen("love.in","r",stdin);
	freopen("love.out","w",stdout);
	read(n);
	for(int i=1;i<=n;++i){
		read(op[i]);
		if(op[i]==1){
			int F,B;
			read(F),read(T[i]),read(B);
			id[++idx]=i;
			if(T[i]==0){
				a[i]=B;
				b[idx]=(node){1e17,i};
				continue;
			}
			int v=T[i]*F+B;
			b[idx]=(node){val[i]=(double)v/T[i],i};
			T[i]=abs(T[i]);
		}else read(k[i]);
	}
	sort(b+1,b+idx+1,cmp);
	int m=1;
	for(int i=1,id=1;i<=idx;++i){
		if(T[b[i].i]==0) continue;
		if(i>1&&fabs(b[i].x-b[i-1].x)>eps) v[++m]=b[i].x;
		a[b[i].i]=m;
	}
	for(int i=1;i<=n;++i){
		if(op[i]==1){
			if(T[i]) change(1,1,m,a[i],val[i]*T[i],T[i]);
			else tag+=abs(a[i]);
		}else{
			if(T[id[k[i]]]) change(1,1,m,a[id[k[i]]],-val[id[k[i]]]*T[id[k[i]]],-T[id[k[i]]]);
			else tag-=abs(a[id[k[i]]]); 
		}
		S=(t[1].st+1)/2;
		ls=rs=0;
		lt=rt=pt=0;
		query(1,1,m);
		printf("%.9lf\n",v[pt]*(lt-rt)+rs-ls+tag);
	}
	return 0;
}

